package com.dst.controller;

import com.dst.eneity.Brand;
import com.dst.service.BrandService;
import com.dst.service.impl.BrandServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/brand/addBrandController")
public class AddBrandController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");
        BrandService brandService = new BrandServiceImpl();
        brandService.addBrandService(new Brand(null,name));
        resp.sendRedirect(req.getContextPath()+"/brand/selectAllBrandController");
    }
}
